package ar.uade.distribuidas.tpo.dba.dao;

import java.rmi.RemoteException;

import org.hibernate.Session;

import ar.uade.distribuidas.tpo.dba.dominio.Proveedor;
import ar.uade.distribuidas.tpo.dba.hbt.HibernateDAO;


public class ProveedorDAO extends HibernateDAO{
	public static ProveedorDAO instance;

	protected ProveedorDAO(){
	}

	public static ProveedorDAO getInstance() {
		if (instance == null){
			instance = new ProveedorDAO();
		}
		return instance;
	}
	
	public Proveedor getProveedor(Long cuil)throws RemoteException{
		Session session = sf.openSession();
		
		Proveedor p = (Proveedor) session.createQuery("from Proveedor where cuil = :cuil").setParameter("cuil", cuil).list().get(0);		
		
		session.close();
		return p;
	}
}
